package com.lebang.model.enums.buss;

/**
 *  任务状态
 * @className  任务状态
 * @author weizx  
 * @date 2018年6月27日 上午11:52:25
 */
public enum DownStatus {

	/**
	 *  任务状态
	 */
	WAIT_PUSH("待提交", 0),
	SUCCESS("任务成功", 1),
	RELSE("任务主动放弃", -1),
	SYS_RELSE("系统释放", -3),
	FAIL("任务失败", -2),
	;

	private String title;
	private int index;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	private DownStatus(String title, int index) {
		this.title = title;
		this.index = index;
	}
	
	public DownStatus getByIndex(int index) {
		for (DownStatus e : DownStatus.values()) {
			if (e.index == index) {
				return e;
			}
		}
		return null;
	}
	
	public DownStatus getByTitle(String title) {
		if (null == title) {
			return null;
		}
		for (DownStatus e : DownStatus.values()) {
			if (e.title.equals(title)) {
				return e;
			}
		}
		return null;
	}
}
